package com.ruoyi.finance.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.finance.vo.SummaryDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.finance.mapper.SummaryMapper;
import com.ruoyi.finance.domain.Summary;
import com.ruoyi.finance.service.ISummaryService;

/**
 * 摘要表Service业务层处理
 *
 * @author ruoyi
 * @date 2025-02-27
 */
@Service
public class SummaryServiceImpl implements ISummaryService
{
    @Autowired
    private SummaryMapper summaryMapper;

    /**
     * 查询摘要表
     *
     * @param summaryId 摘要表主键
     * @return 摘要表
     */
    @Override
    public Summary selectSummaryBySummaryId(Long summaryId)
    {
        return summaryMapper.selectSummaryBySummaryId(summaryId);
    }

    /**
     * 查询摘要表列表
     *
     * @param summary 摘要表
     * @return 摘要表
     */
    @Override
    public List<Summary> selectSummaryList(Summary summary)
    {
        return summaryMapper.selectSummaryList(summary);
    }

    /**
     * 新增摘要表
     *
     * @param summary 摘要表
     * @return 结果
     */
    @Override
    public int insertSummary(Summary summary)
    {

        return summaryMapper.insertSummary(summary);
    }

    /**
     * 修改摘要表
     *
     * @param summary 摘要表
     * @return 结果
     */
    @Override
    public int updateSummary(Summary summary)
    {

        return summaryMapper.updateSummary(summary);
    }

    /**
     * 批量删除摘要表
     *
     * @param summaryIds 需要删除的摘要表主键
     * @return 结果
     */
    @Override
    public int deleteSummaryBySummaryIds(Long[] summaryIds)
    {
        return summaryMapper.deleteSummaryBySummaryIds(summaryIds);
    }

    /**
     * 删除摘要表信息
     *
     * @param summaryId 摘要表主键
     * @return 结果
     */
    @Override
    public int deleteSummaryBySummaryId(Long summaryId)
    {
        return summaryMapper.deleteSummaryBySummaryId(summaryId);
    }

    @Override
    public List<Summary> tosummarylist(Summary summary) {
        QueryWrapper<Summary> summaryQueryWrapper = new QueryWrapper<>();
        summaryQueryWrapper.like("summary_content",summary.getSummaryContent());
        List<Summary> summaries = summaryMapper.selectList(summaryQueryWrapper);
        return summaries;
    }

    @Override
    public List<Summary> tosummarylists(SummaryDTO summaryDTO) {
        return summaryMapper.tosummarylists(summaryDTO);
    }
}
